package com.hmx.jpa;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

/**
 * @program: SpringDataJPA
 * @description:
 * @author: hmx
 * @create: 2021-07-13 20:13
 **/
@Table(name = "JPA_CATEGORYS")
@Entity
public class Category {
    private Integer id;
    private String categoryName;
    private Set<Item> items = new HashSet<>();

    @Column(name="CATEGORY_NAME")
    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }

    @ManyToMany(mappedBy = "categories")
    public Set<Item> getItems() {
        return items;
    }

    public void setItems(Set<Item> items) {
        this.items = items;
    }

    @Id
    @GeneratedValue
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }
}
